package com.kcs.dc.report.model.logic;

import com.kcs.common.framework.GenericDto;
import com.kcs.common.utils.Constant;
import com.kcs.common.utils.EventFactory;
import com.kcs.common.utils.LogWriter;
import com.kcs.dc.report.view.dto.LoginDto;
import com.kcs.dc.report.view.dto.MainMenuDto;
import com.kcs.dc.report.view.dto.ReportSearchDto;
import com.kcs.dc.report.view.dto.SettlePastDto;
import com.kcs.dc.report.view.dto.SettleTodayDto;
import com.kcs.dc.report.view.dto.UserProfileDto;

public class mainmenuBL {
	
	public GenericDto gotoEvent(MainMenuDto dto) throws Exception {
		GenericDto genericDto = null;
		EventFactory event = new EventFactory();
		String jspPage = dto.getJspPage();
		try {
		
			if (jspPage.equals("logoff")) {
				/*Write Log*/
				LogWriter.info("Logout Process by UserID: "+dto.getUserId(), Constant.LOGGER_APPLICATION);
				/*-------*/

				genericDto = new LoginDto();
				genericDto.populate(dto);				
				genericDto = event.executeBL("login", "init", genericDto);
				
				return genericDto;
			} else if (jspPage.equals("userprofile")) {
				genericDto = new UserProfileDto();
				genericDto.populate(dto);				
				genericDto = event.executeBL(jspPage, "init", genericDto);
				
				return genericDto;
			} else if (jspPage.equals("report")) {
				genericDto = new ReportSearchDto();
				genericDto.populate(dto);				
				genericDto = event.executeBL(jspPage, "init", genericDto);
				return genericDto;
			} else if (jspPage.equals("settletoday")) {
				genericDto = new SettleTodayDto();
				genericDto.populate(dto);
				genericDto = event.executeBL(jspPage, "init",genericDto);
				return genericDto;
			} else if (jspPage.equals("settlepast")) {
				genericDto = new SettlePastDto();
				genericDto.populate(dto);
				genericDto = event.executeBL(jspPage, "init",genericDto);
				return genericDto;
			} 
			

		} catch (Exception e) {
			LogWriter.error("MainMenuBL [Method : gotoEvent] :" + e.getMessage(), Constant.LOGGER_APPLICATION);
		}
		return genericDto;
	}
}